package cn.iocoder.yudao.module.product.dal.mysql.recommend;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.product.dal.dataobject.recommend.RecommendDO;
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.product.controller.admin.recommend.vo.*;

/**
 * 落地页SKU推荐 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface RecommendMapper extends BaseMapperX<RecommendDO> {

    default PageResult<RecommendDO> selectPage(RecommendPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RecommendDO>()
                .likeIfPresent(RecommendDO::getName, reqVO.getName())
                .eqIfPresent(RecommendDO::getDescription, reqVO.getDescription())
                .eqIfPresent(RecommendDO::getSellPoints, reqVO.getSellPoints())
                .eqIfPresent(RecommendDO::getTag, reqVO.getTag())
                .eqIfPresent(RecommendDO::getSort, reqVO.getSort())
                .eqIfPresent(RecommendDO::getCategoryId, reqVO.getCategoryId())
                .eqIfPresent(RecommendDO::getSpuId, reqVO.getSpuId())
                .eqIfPresent(RecommendDO::getSkuId, reqVO.getSkuId())
                .betweenIfPresent(RecommendDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RecommendDO::getId));
    }
}
